package com.qiangesoft.bootcodegen.controller;

import com.qiangesoft.bootcodegen.entity.BcgProject;
import com.qiangesoft.bootcodegen.framework.log.Log;
import com.qiangesoft.bootcodegen.pojo.dto.BcgProjectDTO;
import com.qiangesoft.bootcodegen.service.IBcgProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 项目配置 前端控制器
 * </p>
 *
 * @author qiangesoft
 * @date 2024-04-01
 */
@Api(tags = "项目配置")
@RequiredArgsConstructor
@RestController
@RequestMapping("/project")
public class BcgProjectController {

    private final IBcgProjectService projectService;

    @Log(module = "项目配置", operationName = "获取项目配置")
    @ApiOperation(value = "获取项目配置")
    @GetMapping
    public BcgProject getProject() {
        return projectService.getProject();
    }

    @Log(module = "项目配置", operationName = "保存项目配置")
    @ApiOperation(value = "保存项目配置")
    @PutMapping("/{id}")
    public void updateProject(@PathVariable Long id, @RequestBody @Validated BcgProjectDTO projectDTO) {
        projectService.updateProject(id, projectDTO);
    }
}
